package com.example.projectdemo.xfrv;

import android.os.Bundle;

import com.example.projectdemo.R;
import com.example.projectdemo.xfrv.multRvDecor.ListDividerItemDecoration;
import com.example.projectdemo.xfrv.multRvDecor.Performer;
import com.example.projectdemo.xfrv.multRvDecor.PerformerListAdapter;
import com.example.projectdemo.xfrv.multRvDecor.StickyItemDecoration;

import java.util.ArrayList;
import java.util.List;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

/***
 * 多布局Rv+自定义下划线
 * https://github.com/chenpengfei88/StickyItemDecoration
 * https://mp.weixin.qq.com/s?__biz=MzAxMTI4MTkwNQ==&mid=2650825230&idx=1&sn=c0b8a385e2bf9a51e1f2dabb7a4fdd87&chksm=80b7b690b7c03f86a119d0db7d497f38e6020281cdf25c9d9f84126d7c697b98c06c59bdf200&mpshare=1&scene=23&srcid=0330kJQcNZdL7nFQ6cqnkKmF#rd
 * https://juejin.im/post/5a70139ff265da3e274574cb
 */
public class XiFuRv1Activity extends AppCompatActivity {

    private RecyclerView mRv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_xi_fu_rv);


        mRv = findViewById(R.id.xfrv);
        mRv.setLayoutManager(new LinearLayoutManager(this));
        mRv.addItemDecoration(new StickyItemDecoration());
        mRv.addItemDecoration(new ListDividerItemDecoration());
        mRv.setAdapter(new PerformerListAdapter(this, getData()));
    }

    private List<Performer> getData() {
        List<Performer> performers = new ArrayList<>();

        Performer performer = new Performer("香港明星");
        performers.add(performer);

        Performer ldh = new Performer("刘德华", 10);
        performers.add(ldh);
        Performer zxy = new Performer("张学友", 10);
        performers.add(zxy);
        Performer zrf = new Performer("周润发", 10);
        performers.add(zrf);
        Performer lcw = new Performer("梁朝伟", 10);
        performers.add(lcw);
        Performer wyj = new Performer("吴毅将", 10);
        performers.add(wyj);
        Performer lm = new Performer("黎明", 10);
        performers.add(lm);
        Performer cgx = new Performer("周润发2", 10);
        performers.add(cgx);
        Performer gfc = new Performer("周润发1", 10);
        performers.add(gfc);
        Performer xtf = new Performer("谢霆锋", 10);
        performers.add(xtf);

        Performer performerTw = new Performer("台湾明星：指的是中国台湾的一些有名气的电影，电视演员和歌手，他们具有很高的人气，成名时间早，成名时间久");
        performers.add(performerTw);

        Performer rxq = new Performer("任贤齐", 10);
        performers.add(rxq);
        Performer mtw = new Performer("孟庭苇", 10);
        performers.add(mtw);

        Performer performerTw2 = new Performer("台湾新生代明星：指的是中国台湾的一些有名气的电影，电视演员和歌手，他们具有很高的人气，成名时间早，成名时间久");
        performers.add(performerTw2);

        Performer rxq2 = new Performer("罗志祥", 10);
        performers.add(rxq2);

        Performer performerTw3 = new Performer("台湾明星：指的是中国台湾的一些有名气的电影，电视演员和歌手，他们具有很高的人气，成名时间早，成名时间久");
        performers.add(performerTw3);

        Performer rxq3 = new Performer("李宗盛", 10);
        performers.add(rxq3);

        Performer performerNl = new Performer("内陆明星");
        performers.add(performerNl);

        Performer lh = new Performer("鹿晗", 10);
        performers.add(lh);
        Performer wzw = new Performer("王志文", 10);
        performers.add(wzw);
        Performer yq = new Performer("羽泉", 10);
        performers.add(yq);
        Performer lxl = new Performer("周润发12", 10);
        performers.add(lxl);
        Performer hh = new Performer("周润发1234", 10);
        performers.add(hh);
        Performer ny = new Performer("周润发432", 10);
        performers.add(ny);
        Performer lhh = new Performer("刘欢", 10);
        performers.add(lhh);
        Performer yk = new Performer("杨坤", 10);
        performers.add(yk);
        Performer zj = new Performer("周润发09", 10);
        performers.add(zj);

        Performer performerOm = new Performer("美国明星");
        performers.add(performerOm);
        Performer mm = new Performer("梅梅", 10);
        performers.add(mm);
        Performer ade = new Performer("Gaga", 10);
        performers.add(ade);
        Performer hff = new Performer("周润发-", 10);
        performers.add(hff);
        Performer xlz = new Performer("小李子", 10);
        performers.add(xlz);

        Performer performerNba = new Performer("NBA明星");
        performers.add(performerNba);
        Performer xhd = new Performer("小皇帝", 10);
        performers.add(xhd);
        Performer kb = new Performer("科比", 10);
        performers.add(kb);
        Performer ym = new Performer("姚明", 10);
        performers.add(ym);
        Performer md = new Performer("麦迪", 10);
        performers.add(md);
        Performer dlt = new Performer("杜兰特", 10);
        performers.add(dlt);
        Performer kl = new Performer("库里", 10);
        performers.add(kl);
        Performer ouw = new Performer("欧文", 10);
        performers.add(ouw);
        Performer qd = new Performer("乔丹", 10);
        performers.add(qd);
        Performer alzw = new Performer("奥拉朱旺", 10);
        performers.add(alzw);
        Performer pp = new Performer("皮蓬", 10);
        performers.add(pp);
        Performer ldm = new Performer("罗德曼", 10);
        performers.add(ldm);
        Performer ke = new Performer("科尔", 10);
        performers.add(ke);
        Performer pesi = new Performer("皮尔斯", 10);
        performers.add(pesi);
        Performer jnt = new Performer("加内特", 10);
        performers.add(jnt);
        Performer lal = new Performer("雷阿伦", 10);
        performers.add(lal);
        Performer zmg = new Performer("字母哥", 10);
        performers.add(zmg);
        Performer adn = new Performer("安东尼", 10);
        performers.add(adn);

        Performer performerDy = new Performer("导演");
        performers.add(performerDy);
        Performer jzk = new Performer("贾樟柯", 10);
        performers.add(jzk);
        Performer ly = new Performer("李杨", 10);
        performers.add(ly);
        Performer fxg = new Performer("冯小刚", 10);
        performers.add(fxg);
        Performer lyy = new Performer("娄烨", 10);
        performers.add(lyy);
        Performer zym = new Performer("张艺谋", 10);
        performers.add(zym);

        return performers;
    }

    /*public static void main(String[] str) {

        ThreadA t1 = new ThreadA("t1");
        t1.zhi = 1000;
        ThreadA t2 = new ThreadA("t2");
        t2.zhi = 5;
        t1.setDaemon(true);

        t1.start();
        t2.start();
    }

    static class ThreadA extends Thread {

        public int zhi;

        public ThreadA(String name) {
            super(name);
        }

        public void run() {
            if (zhi == 1000) {
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            for (int i = 0; i < zhi; i++) {
                System.out.printf("%s [%d]:%d\n", this.getName() + "==========", this.getPriority(), i);
                System.out.println("=====" + isDaemon());
            }
//            synchronized (objectName) {
//                for(int i=0; i <10; i++){
//                    System.out.printf("%s [%d]:%d\n", this.getName() + "==========", this.getPriority(), i);
//
//                    if (i%4 == 0) {
//                        try {
//                            Thread.sleep(1000);
//                        } catch (InterruptedException e) {
//                            e.printStackTrace();
//                        }
//                    }
//                }
//            }
        }
    }*/
}


